<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="student/common :: commonhead">
    <!--<div th:replace="student/common :: commonhead"></div>-->
</head>
<head>
    <title>我的课程</title>
    <!--这里写这个页面单独需要的css-->
    <style>
        .btn-circle {
            width: 30px;
            height: 30px;
            text-align: center;
            padding: 6px 0;
            font-size: 12px;
            line-height: 1.428571429;
            border-radius: 15px;
        }
        .btn-circle.btn-lg {
            width: 50px;
            height: 50px;
            padding: 10px 16px;
            font-size: 18px;
            line-height: 1.33;
            border-radius: 25px;
        }
        .btn-circle.btn-xl {
            width: 70px;
            height: 70px;
            padding: 10px 16px;
            font-size: 24px;
            line-height: 1.33;
            border-radius: 35px;
        }
    </style>
</head>
<body class="sticky-header">

<section>
    <!--  引入左侧边  -->
    <div th:replace="student/common :: left"></div>

    <div class="main-content">
        <div th:replace="student/common :: header-section"></div>
        <!--这里开始写东西-->
        <div class="wrapper">

            <section class="panel">
                <header class="panel-heading">
                    <span>我的课程</span>
                    <span class="tools pull-right">
                        <a class="fa fa-plus" th:href="@{/student/addCourse}"></a>
                        <a class="fa fa-chevron-down" href="javascript:;"></a>
                    </span>
                </header>
                <div class="panel-body">
                    <!--内容-->
                    <div class="row placeholders" id="courses">
                        <div class="col-xs-6 col-sm-2 placeholder" th:each="course : ${courses}">
                            <button class="btn btn-info btn-circle btn-xl" th:id="${course.couId}" onclick="showStudentHomework(this.id)" th:value="${course.couId}">
                                [[${#strings.substring(course.couName, 0, 1)}]]
                            </button>
                            <h4>[[${course.couName}]]</h4>
                            <span class="text-muted">[[${course.couStart}]]-[[${course.couEnd}]]</span><br>
                            <span class="text-muted">[[${course.teaName}]]</span>
                        </div>
                    </div>
                </div>
            </section>

            <section class="panel" th:fragment="StudentHomeworkList" id="studentHomeworkList">
                <header class="panel-heading">
                    <span>课程作业</span>
                    <span class="tools pull-right">
                        <a class="fa fa-chevron-down" href="javascript:;"></a>
                    </span>
                </header>
                <div class="panel-body" >
                    <div class="table-responsive" id="homeworks">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>标题</th>
                                <th>开始日期</th>
                                <th>截止日期</th>
                                <th>分数</th>
                                <th>完成状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="hw : ${homeworks}">
                                <td>
                                    <a th:if="${hw.hwsState != -1 && hw.hwsState != 3}" th:text="${hw.hwTitle}" th:href="@{/student/checkHomework(stuId=${session.student.stuId}, hwId=${hw.hwId})}"></a>
                                    <span th:if="${hw.hwsState == -1 || hw.hwsState == 3}" th:text="${hw.hwTitle}"></span>
                                </td>
                                <td th:text="${#temporals.format(hw.hwStartTime, 'yyyy-MM-dd hh:mm')}"></td>
                                <td th:text="${#temporals.format(hw.hwEndTime, 'yyyy-MM-dd hh:mm')}"></td>
                                <td th:text="${hw.hwsMark} + ' / ' + ${hw.hwFullMark}"></td>
                                <td th:if="${hw.hwsState == -1 || hw.hwsState == 3}">未完成</td>
                                <td th:if="${hw.hwsState == 0}">已提交</td>
                                <td th:if="${hw.hwsState == 1}">已批该</td>
                                <td th:if="${hw.hwsState == 2}">已截止</td>
                                <td >
                                    <a class="btn btn-primary" th:if="${hw.hwsState == -1}" th:href="@{/student/doHomework/}+${hw.hwId}">做作业</a>
                                    <a class="btn btn-success" th:if="${hw.hwsState == 0}" th:href="@{/student/editHomework/}+${hw.hwId}">重新编辑</a>
                                    <a class="btn btn-warning" th:if="${hw.hwsState == 1}">已批改</a>
                                    <a class="btn btn-danger" th:if="${hw.hwsState == 2 || hw.hwsState == 3}">已截止</a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </section>

        </div>
    </div>
</section>

<div th:replace="student/common :: commonjs"></div>
<script src="js/myAjax.js" th:src="@{/js/myAjax.js}"></script>

</body>
</html>